{% extends "base.html" %}
{% import "_macros.html" as macros %}
{% import "_my_wtf_macros.html" as my_wtf_macros %}

{% block title %}万屏时代OPC--代金券{{ voucher_stat_type.title }}{% endblock %}

{% block panel_heading %}
  万屏时代OPC--代金券{{ voucher_stat_type.title }}
{% endblock %}

{% block panel_body %}
    <form id="search-form" action="{{ url_for('op_bp.voucher_type_stat', voucher_stat_type=voucher_stat_type.value) }}" method="post" class="form" role="form">
        {{ my_wtf_macros.form_field(form.start_date, div_col=4, label_col=4, field_col=7) }}
        {{ my_wtf_macros.form_field(form.end_date, div_col=4, label_col=4, field_col=7) }}
        <div class="clearfix visible-xs-block visible-sm-block visible-md-block visible-lg-block"></div>
        <div class="pull-right btn-group">
            <button type="submit" class="btn btn-info">
                查询
            </button>
        </div>
    </form>

    <table id="sms-log-table" class="table table-bordered table-hover table-condensed table-striped table-responsive">
        <thead>
            <tr>
                <th>统计<br>日期</th>
                {% for td_display, _, _ in voucher_stat_type.table_ths %}
                    <th>{{ td_display }}<br>(张/人)</th>
                {% endfor %}
            </tr>
        </thead>
        <tbody>
        {% for stat_date, each in data.items() %}
            <tr>
                <td>{{ stat_date }}</td>
                {% for _, stat_key, stat_user_key in voucher_stat_type.table_ths %}
                    <td>{{ each[stat_key] or 0 }}/{{ each[stat_user_key] or 0 }}</td>
                {% endfor %}
            </tr>
        {% endfor %}
        </tbody>
    </table>

{% endblock %}
